<!--  -->
<template>
  <div class="me">
    <header>
      <template v-if="pdsfdr">
        <img :src="grenxx + userInfo.avatar" alt="" />
        <span>{{ userInfo.nickname }}</span>
      </template>
      <template v-else>
        <img src="" alt="" />
        <span @click="deruyaaa">登入/注册</span>
      </template>
    </header>
    <van-grid>
      <van-grid-item icon="paid" text="待付款" />
      <van-grid-item icon="records" text="待发货" />
      <van-grid-item icon="tosend" text="已发货" />
      <van-grid-item icon="logistics" text="已完成" />
    </van-grid>
    <van-cell title="我的订单" icon="todo-list-o" to="/wodedingdan"  is-link/>
    <van-cell title="我的收藏" icon="like-o" to="/wodeshouc" is-link/>
    <van-cell title="收货地址" icon="orders-o"  is-link @click="dshdzzzz"/>
    <van-cell title="用户设置" icon="setting-o" to="/usersetting" is-link/>
  </div>
  
</template>

<script>
import { mapState } from "vuex";
import { GYDZ } from "network/api.js";
export default {
  name: "me",
  data() {
    return {
      grenxx: "",
    };
  },

  computed: {
    ...mapState(["userInfo"]),
    pdsfdr() {
      if (this.userInfo.nickname || this.userInfo.password) return true;
      return false;
    },
  },

  methods: {
    dshdzzzz(){
      this.$router.push({
        path:'/shouhuodizhi',
        query:{
          df:"me"
        }
      })
    },
    deruyaaa() {
      if (!this.pdsfdr) {
        this.$router.push("/login");
      }
      // console.log(!this.pdsfdr)
    },
  },
  created() {
    this.grenxx = GYDZ;
  },
};
</script>
<style lang='less' scoped>
header {
  height: 92px;
  background: #f37d0f;
  display: flex;
  align-items: center;
  img {
    width: 60px;
    height: 60px;
    margin: 0 5px 0 10px;
  }
  span {
    color: #fff;
    font-size: 13px;
    font-weight: bold;
  }
}
</style>